package com.huilai.platform.country_platform.core;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 作者：洪霓
 * 日期：2023/2/28
 * 注释：
 */
@Configuration
public class MyPlatformConfigurer implements WebMvcConfigurer {

    @Value("${file.upload.path}")
    private String filePath;

    @Value("${file.upload.relative}")
    private String fileRelativePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        registry.addResourceHandler(fileRelativePath).
                addResourceLocations("file:/"+filePath);
    }
}
